/*
 * Copyright (c) 2006-2018, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2018-11-10     SummerGift   first version
 */

#ifndef __DRV_DMA_H_
#define __DRV_DMA_H_

#include <rtthread.h>
#include "rtdevice.h"
#include <rthw.h>
#include <drv_common.h>

#ifdef __cplusplus
extern "C" {
#endif

#define DMA_INTF_GL                  (uint8_t)0x00                  /*!< global interrupt flag of channel */
#define DMA_INTF_TC                  (uint8_t)0x01                  /*!< full transfer finish flag of channel */
#define DMA_INTF_HT                  (uint8_t)0x02                  /*!< half transfer finish flag of channel */
#define DMA_INTF_ERR                 (uint8_t)0x04                  /*!< error flag of channel */

struct dma_config {
    DMA_Type *dma_periph;
    DMA_Channel_Type *channel;
    rt_uint8_t DMAx_INTC_shift; //DMA channelx flag shift
    
    rt_uint32_t dma_rcc;
    IRQn_Type dma_irq;
};

#ifdef __cplusplus
}
#endif

#endif /*__DRV_DMA_H_ */
